<template>
  <div class="detailPageCss">
    <div class="titleCss">{{ $route.query.id ? '编辑' : '添加'}}协管员</div>
    <div class="bodyCss">
      <el-form ref="form" :model="formData" label-width="140px">
        <el-row>
          <el-form-item label="协管员名称">
            <el-input v-model="formData.data1" placeholder="请输入"></el-input>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="人员类型">
            <el-select v-model="formData.data2" placeholder="请选择" style="width:100%;">
              <el-option
                v-for="item in data2Options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="联系电话">
            <el-input v-model="formData.data3" placeholder="请输入"></el-input>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="身份证号">
            <el-input v-model="formData.data4" placeholder="请输入"></el-input>
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="发证日期">
            <el-date-picker v-model="formData.data5" type="date" placeholder="请选择" style="width:100%;" />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label="协管区域">
            <el-select v-model="formData.data6" placeholder="请选择" style="width:100%;">
              <el-option
                v-for="item in data6Options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-row>
      </el-form>
    </div>
    <div class="bottomBtnCss">
      <el-button @click="goBackBtn">返回</el-button>
      <el-button type="primary" @click="submitBtn">提交</el-button>
    </div>
  </div>
</template>

<script>
import { getSelectOptionsFun } from '@/utils/business.js'
export default {
  data(){
    return{
      formData:{
        data1:null,
        data2:null,
        data3:null,
        data4:null,
        data5:null,
        data6:null,
      },
      data2Options:[],
      data6Options:[],
    }
  },
  mounted(){
    this.data2Options = getSelectOptionsFun()
    this.data6Options = getSelectOptionsFun()
  },
  methods:{
    submitBtn(){
      this.$router.back()
    },
    goBackBtn(){
      this.$router.back()
    },
  },
}
</script>

<style lang="scss" scoped>
.detailPageCss{
  overflow: hidden;
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  height: calc( 100vh - 66px - 40px);
  display: flex;
  flex-direction: column;
  .titleCss{
    text-align: center;
    font-size: 18px;
    font-weight: bold;
  }
  .bodyCss{
    margin-top: 40px;
    width: 500px;
    margin-left: 50%;
    transform: translateX( calc( -50% - 70px ));
  }
  .bottomBtnCss{
    margin-top: auto;
    text-align: right;
  }
}
</style>